package com.yanqu.road.server.cmd.cricket;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cricket.CricketProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.cricket.CricketModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：xx
 */
@Cmd(code = GameProtocol.S_CRICKET_GET_REWARD_RELATION, desc = "缘分值庙里获得")
public class CricketGetRelationRewardCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CricketProto.CricketGetRelationMessageReqMsg msg = CricketProto.CricketGetRelationMessageReqMsg.parseFrom(packet.getBytes());
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.getModule(CricketModule.class).relationRewardGet();
    }

    @Override
    public void sendData(GamePlayer player) {
        if(ret != 0){
            CricketProto.CricketGetRelationMessageRespMsg.Builder respMsg = CricketProto.CricketGetRelationMessageRespMsg.newBuilder();
            player.sendPacket(ClientProtocol.U_CRICKET_GET_REWARD_RELATION, respMsg);
        }
    }
}
